package manager;

import java.util.ArrayList;
import data.dao.*;
import data.dto.*;
import data.dao.daoFactory.*;

public class LeaveManager {
	private LeaveDAO leaveDAO;
	private ArrayList<LeaveDTO> leavelist;

	public LeaveManager() {
		this.leaveDAO = LeaveFactory.loadInstance().getLeaveDAO();
	}

	public ArrayList<LeaveDTO> findAllLeave() throws LeaveDAOException {
		
		leavelist = new ArrayList<LeaveDTO>(); 
		try 
		{
			leaveDAO.findAllLeave();
		} 
		catch (LeaveDAOException e) 
		{
			e.printStackTrace();
		}
		return leavelist;
	}

	public void insertLeaveDetail(LeaveDTO LeaveDetail)
			throws LeaveDAOException {

		try 
		{
			leaveDAO.insertLeaveDetail(LeaveDetail);
		} 
		catch (LeaveDAOException e) 
		{
			e.printStackTrace();
		}
	}

	public void updateLeaveDetail(LeaveDTO LeaveDetail)
			throws LeaveDAOException {
		try 
		{
			leaveDAO.updateLeaveDetail(LeaveDetail);
		} 
		catch (LeaveDAOException e) 
		{
			e.printStackTrace();
		}

	}

	public void deleteLeaveDetail(LeaveDTO LeaveDetail)
			throws LeaveDAOException {
		try 
		{
			leaveDAO.deleteLeaveDetail(LeaveDetail);
		} 
		catch (LeaveDAOException e) 
		{
			e.printStackTrace();
		}
	}

}
